CREATE TABLE [dbo].[App_historial_precios]
(
[id_historial] [dbo].[_autonumerico] NOT NULL IDENTITY(1, 1),
[id_entidad] [dbo].[_codigo] NOT NULL,
[id_proveedor] [dbo].[_codigo] NOT NULL,
[id_articulo] [dbo].[_codigo] NOT NULL,
[fe_precio] [dbo].[_fechahora] NOT NULL,
[im_precio_base] [dbo].[_importe] NOT NULL,
[im_precio_neto] [dbo].[_importe] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[App_historial_precios] ADD CONSTRAINT [PK_App_historial_precios] PRIMARY KEY CLUSTERED  ([id_historial]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[App_historial_precios] ADD CONSTRAINT [FK_App_historial_precios_App_articulo] FOREIGN KEY ([id_articulo]) REFERENCES [dbo].[App_articulo] ([id_articulo])
GO
ALTER TABLE [dbo].[App_historial_precios] ADD CONSTRAINT [FK_App_historial_precios_App_entidad] FOREIGN KEY ([id_entidad]) REFERENCES [dbo].[App_entidad] ([id_entidad])
GO
EXEC sp_bindefault N'[dbo].[date]', N'[dbo].[App_historial_precios].[fe_precio]'
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[App_historial_precios].[im_precio_base]'
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[App_historial_precios].[im_precio_neto]'
GO
